#!/usr/bin/env node

pr = process.stdout.write
prn = console.log
enc = encodeURIComponent
argv = process.argv.slice(2)

if (argv.length > 0) {
  for (const arg of argv) {
    prn(enc(arg))
  }
} else {
  process.stdin.on('data', (data) => {
    data = data.toString()
    lines = data.split("\n")
    for (const line of lines) {
      if (line.trim().length > 0) {
        prn(enc(line))
      }
    }
  });
}
